package com.fly.video.downloader.core.content;


import ohos.app.Context;
import ohos.miscservices.pasteboard.PasteData;
import ohos.miscservices.pasteboard.SystemPasteboard;

public class ClipboardManager {
    protected Context context;
    protected SystemPasteboard clipBoard;

    public ClipboardManager(Context context)
    {
        clipBoard = SystemPasteboard.getSystemPasteboard(context);
        this.context = context;
    }

    public Context getContext() {
        return context;
    }

    public SystemPasteboard getClipBoard() {
        return clipBoard;
    }

    public PasteData getClipData()
    {
        return clipBoard.getPasteData();
    }

    public String getText(int index)
    {
        PasteData clipData = getClipData();
        if (clipData == null)
            return null;
        PasteData.Record clipItem = clipData.getRecordAt(index);

        return clipItem.getPlainText().toString();
    }
}
